#pragma once
#include "tcpsocket.h"
#include "iAcceptHandler.h"
#include "list"

namespace _FOGGE_
{

	namespace _NET_
	{

		
		class ServerTCPSocket :
			public TCPSocket
		{
		public:
			ServerTCPSocket(iAcceptHandler* _iAcceptHandler);
			~ServerTCPSocket(void);


			HRESULT Listen(int port);

			HRESULT Update(float ellpsedtime);

			void StartThread(LPTSTR ip,int port);
			void EndThread();



		protected:
			void SetSocketOption();
			void OnAccept(SOCKET acceptedsocket,sockaddr* ptraddr);

		private:
			std::list<ClientTCPSocket*>	 m_AcceptedSocketList;
			iAcceptHandler* i_AcceptHandler;
		};

	}
}